import { http } from "whatwg-request";

export async function post(url: string, data = {}, headers = {}) {
  return http(url, {
    method: "POST",
    mode: "cors",
    headers: { "Content-Type": "application/json", ...headers },
    body: JSON.stringify(data),
  });
}

export async function put(url: string, data: File, headers = {}) {
  return http(url, {
    method: "PUT",
    mode: "cors",
    headers: { "Content-Type": "application/json", ...headers },
    body: data,
  });
}
